<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" import="custom.*, java.util.*" %>
<html>
<%	// get session attributes for name, address
	String firstName = (String)session.getAttribute("firstName");
	String middleName = (String)session.getAttribute("middleName");
	String lastName = (String)session.getAttribute("lastName");
	int ccid = (Integer)session.getAttribute("ccid");
	int crid = (Integer)session.getAttribute("crid");
	String street = (String)session.getAttribute("street");
	String city = (String)session.getAttribute("city");
	String state = (String)session.getAttribute("state");
	String ctc = (String)session.getAttribute("ctc");
	String zip = (String)session.getAttribute("zip");
	String area = (String)session.getAttribute("area");
    String phone = (String)session.getAttribute("phone");

	// set session attribute for degree
	int spId = Integer.parseInt(request.getParameter("specializationId") );
    session.setAttribute("specializationId", spId);
	Vector<LinkedHashMap<String, Object>> degrees = (Vector<LinkedHashMap<String, Object>>)session.getAttribute("degrees");

    Vector countries = support.getCountries();
    Vector uniTuple = support.getUniversities();
	Vector sp = support.getSpecializations();
	String specialization = (String)sp.get(spId);
	Vector majors = support.getMajors();
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Verification</title>
</head>
<body>
<h2> Please verify your information:</h2>
 First Name: <%= firstName %>
 <br>
 Middle Initial: <%= middleName %>
 <br>
 Last Name: <%= lastName %>
 <br>
 Country of citizenship: <%= countries.get(ccid) %>
 <br>
 Country of residence: <%= countries.get(crid) %>
 <br>
 Street: <%= street %>
 <br>
 City: <%= city %>
 <br>
 <!-- if country of residnece is US, display state, else display country telephone code -->
 <% if(crid==support.us_id) { %>
 State: <%= state %>
 <% } else { %>
 Country telephone code: <%= ctc %>
 <% } %>
 <br>
 Zip code: <%= zip %>
 <br>
 Area code: <%= area %>
 <br>
 Phone: <%= phone %>
 <p>
<h3>Degree(s):</h3> <p>
<%	// list the information for all the degrees entered by the applicant
	for ( LinkedHashMap<String, Object> deg : degrees) {
        String loc = (String)((Vector)uniTuple.get((Integer)deg.get("location"))).get(0);
	    String uni = (String)deg.get("uniName");
        String major = (String)deg.get("majorName");
		String month = (String)deg.get("month");
		String year = (String)deg.get("year");
		String gpa = (String)deg.get("gpa");
		String type = (String)deg.get("type");
%>
Location: <%= loc %> <br>
University: <%= uni %> <br>
Major: <%= major %> <br>
Expected month of graduation: <%= month %> <br>
Expected year of graduation: <%= year %> <br>
Expected GPA: <%= gpa %> <br>
Degree type: <%= type %> <br>
<p>
<% } %>
Specialization: <%= specialization %> <p>
<form method="GET" action="submitted.jsp">
<input type="submit" value="Submit application" />
</form>
<form method="GET" action="cancel.jsp">
<input type="submit" value="Cancel" />
</form>
</body>
</html>
